package org.wzh.spring.di.demo1;

import org.springframework.stereotype.Component;

/**
 * @Component 注解表明该类会作为组件类,并告知Spring要为这个类创建bean.
 * 没有必要显式配置SgtPeppers bean,因为这类使用了@Component注解,所有Spring会为你把事情处理妥当.
 * 不过,组件扫描默认是不启用的.我们还需要显式配置一下Spring,从而命令它去寻找带有@Component注解的类,并为其创建bean.
 * @author Pear
 *
 */
@Component
public class SgtPeppers implements CompactDisc {

	private String title = "Sgt. Pepper's Lonely Hearts Club Band";
	private String artist = "The Beatles";
	
	@Override
	public void play() {
		// TODO Auto-generated method stub
		System.out.println("Playing " + title + " by " + artist);
	}

}
